﻿// ***********************************************************************
// Assembly         : STX.Repository
// Author           : seven.x
// Created          : 12-29-2013
//
// Last Modified By : seven.x
// Last Modified On : 12-29-2013
// ***********************************************************************
// <copyright file="ITransactionContext.cs" company="驰创数码">
//     Copyright (c) 驰创数码. All rights reserved.
// </copyright>
// <summary></summary>
// ***********************************************************************
using System;
using STX.Domain;

namespace STX.Repository
{
    /// <summary>
    /// Interface ITransition
    /// </summary>
    public interface ITransactionContext : IDisposable
    {
        /// <summary>
        /// Gets the repository.
        /// </summary>
        /// <typeparam name="TEntity">The type of the attribute entity.</typeparam>
        /// <returns>STX.Repository.IRepository{TEntity}.</returns>
        IRepository<TEntity> GetRepository<TEntity>()
            where TEntity : BaseEntity;


        /// <summary>
        /// Begins the transaction.
        /// </summary>
        void BeginTransaction();


        /// <summary>
        /// Commits this instance.
        /// </summary>
        void Commit();


        /// <summary>
        /// Rollbacks this instance.
        /// </summary>
        void Rollback();


        /// <summary>
        /// Gets the affected rows.
        /// </summary>
        /// <value>The affected rows.</value>
        int AffectedRows { get; }
    }
}
